package com.zjb.wxlisener.service.impl;

import com.zjb.wxlisener.JavaBean.Music;
import com.zjb.wxlisener.mapper.MusicListMapper;
import com.zjb.wxlisener.service.MusicListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class MusicListServiceimpl implements MusicListService {
    @Autowired
    MusicListMapper musicListMapper;
    @Override
    public List<Music> getMusicList(Integer id) {
        List<Music> musicList = new ArrayList<Music>();
        List<Integer> musicIdList = musicListMapper.getMusicIdList(id);
        for (Integer musicid:musicIdList){
            musicList.add(musicListMapper.getMusicList(musicid));
        }
        return musicList;
    }

    @Override
    public String getMusicUrlByid(Integer id) {
        String url = musicListMapper.getMusicUrlByid(id);
        return url;
    }
}
